﻿using Orleans;
using Orleans.Runtime.Host;
using Pay.Cache;
using Pay.Configuration;
using Pay.Container;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Server
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "Orleans Server";
            using (var host = new SiloHost("default"))
            {
                Config.Init(ConfigurationManager.AppSettings["config:path"]);
                // 初始化redis连接
                RedisConnection.Init(Config.GetValue("redis:connection"), Config.GetValue("redis:key"));
                LocManager.Register();
                host.LoadOrleansConfig();
                host.InitializeOrleansSilo();
                host.StartOrleansSilo();
                Console.WriteLine("server is started!!!");
                string input = string.Empty;
                while (!input.Equals("quit"))
                {
                     input = Console.ReadLine();
                }

                host.StopOrleansSilo();
            }
        }
    }
}
